﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SMTC.Dao.DataServer;
using SMTC.BO.Common;
using SMTC.Model.Domain;

namespace SMTC.BO.DataServer
{
    public class DataServerServices
    {
        private DataServerDao _dao = new DataServerDao();

                /// <summary>
        /// 获取链路服务器列表
        /// </summary>
        /// <param name="Name">服务名</param>
        /// <returns></returns>
        public List<DataServerDomain> GetServerList(string Name)
        {
            Name = DbValueProccess.StrProccess(Name);
            return _dao.GetServerList(Name);
        }

        public bool DelServer(string Name)
        {
            Name = DbValueProccess.StrProccess(Name, false);
            return _dao.DelServer(Name) && _dao.ModifyDataView(System.Configuration.ConfigurationSettings.AppSettings["DataServerName"]);
        }

        public bool AddServer(string IP, string userName, string PassWord)
        {
            return _dao.AddServer(IP, userName, PassWord) && _dao.ModifyDataView(System.Configuration.ConfigurationSettings.AppSettings["DataServerName"].ToString());
        }

        /// <summary>
        /// 抽取原件数量
        /// </summary>
        /// <returns></returns>
        public int GetUnitCount()
        {
            return _dao.GetUnitCount();
        }
    }
}
